package org.sam.beatles.event;

import org.springframework.context.ApplicationEvent;

/**
 * 系统自定义日志事件对象
 * 
 * @author li
 *
 */
public class LogEvent extends ApplicationEvent {

	private static final long serialVersionUID = -8370942880260952114L;

	/**
	 * 日志等级
	 */
	private LogLevel level = LogLevel.Info;

	/**
	 * 提示信息
	 */
	private String msg;

	/**
	 * 错误分组
	 */
	private String group;

	public LogLevel getLevel() {
		return level;
	}

	public void setLevel(LogLevel level) {
		this.level = level;
	}

	public String getMsg() {
		return msg;
	}

	public void setMsg(String msg) {
		this.msg = msg;
	}

	public String getGroup() {
		return group;
	}

	public void setGroup(String group) {
		this.group = group;
	}

	/**
	 * 系统自定义日志事件对象
	 * 
	 * @param source
	 * @param message
	 */
	public LogEvent(Object source, String message) {
		super(source);
		this.msg = message;
	}

	/**
	 * 系统自定义日志事件对象
	 * 
	 * @param source
	 * @param level
	 * @param msg
	 */
	public LogEvent(Object source, LogLevel level, String msg) {
		super(source);
		this.level = level;
		this.msg = msg;
	}

	/**
	 * 系统自定义日志事件对象
	 * @param source
	 * @param group
	 * @param level
	 * @param msg
	 */
	public LogEvent(Object source,String group, LogLevel level, String msg) {
		super(source);
		this.level = level;
		this.msg = msg;
		this.group = group;
	}



	/**
	 * 日志等级
	 * 
	 * @author li
	 *
	 */
	public enum LogLevel {
		/**
		 * 提示
		 */
		Info,
		/**
		 * 信息
		 */
		Message,
		/**
		 * 警告
		 */
		Warning,
		/**
		 * 错误
		 */
		Error
	}
}
